/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Persistencia.Controladoras.MateriaPrima;


import Logica.Core.MateriaPrima.YerbaAjena;
import Persistencia.JPAControllers.YerbaAjenaJpaController;
import Persistencia.JPAControllers.exceptions.NonexistentEntityException;
import Persistencia.JPAControllers.exceptions.PreexistingEntityException;
import java.util.List;

/**
 *
 * @author Luciano
 */
public class ControladoraPersistenciaYerbaAjena{

    protected YerbaAjenaJpaController miJpa = new YerbaAjenaJpaController();
            
    public void crearYerbaAjena(YerbaAjena unYerbaAjena) throws PreexistingEntityException, Exception {
        miJpa.create(unYerbaAjena);
    }

    public YerbaAjena dameUnaYerbaAjena(int id) {
        return miJpa.findYerbaAjena(id);
    }

    public List<YerbaAjena> dameMisYerbaAjenas() {
        return miJpa.findYerbaAjenaEntities();
    }

    public void eliminarYerbaAjena(int id) throws NonexistentEntityException, Exception {
        miJpa.destroy(id);
    }

    public void modificarYerbaAjena(YerbaAjena miYerbaAjena) throws NonexistentEntityException, Exception {
        miJpa.edit(miYerbaAjena);
    }
}
